package com.champrin.replicationofmyblockapix.tile;

public class Tile {
    public int initNumber = 0; // 初始生成的数字，初始没有生成数字则为 0
    public int initColor = 0; // 数字的颜色
    public int activatedColor = -1; // 激活后显示的颜色，没有被激活则为-1

    public Position<Float> centerPosition = new Position<>(); // 格子的中心坐标
    public Position<Float> startPosition = new Position<>(); // 格子的左上角坐标
    public Position<Float> endPosition = new Position<>(); // 格子的右下角坐标

    public Tile(float startX, float startY, float endX, float endY) {
        this.startPosition.x = startX;
        this.startPosition.y = startY;
        this.endPosition.x = endX;
        this.endPosition.y = endY;
        this.centerPosition.x = (startX + endX) * 0.5f;
        this.centerPosition.y = (startY + endY) * 0.5f;
    }

    public Tile(float startX, float startY, float endX, float endY, int initNumber, int initColor) {
        this.startPosition.x = startX;
        this.startPosition.y = startY;
        this.endPosition.x = endX;
        this.endPosition.y = endY;
        this.centerPosition.x = (startX + endX) * 0.5f;
        this.centerPosition.y = (startY + endY) * 0.5f;

        this.initNumber = initNumber;
        this.initColor = initColor;
    }

    public String ToSaveGameDataString() {
        return this.startPosition.x + "=" + this.startPosition.y + "="
                + this.endPosition.x + "=" + this.endPosition.y + "="
                + this.initNumber + "=" + initColor + "=" + activatedColor;
    }

}
